package com.hotacorp.opencloud.authserver.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.hotacorp.opencloud.common.authcommon.SysClientBean;
import com.hotacorp.opencloud.common.authcommon.SysUserBean;
import com.hotacorp.opencloud.common.commdata.Result;

/**
 * 匿名访问client和user信息，以用户登录验证
 * @author lwg
 *
 */
@FeignClient(value="${user.servicename}", fallback = UserFeignClientHystric.class)
public interface UserFeignClient {

	/**
	 * feign rpc访问远程/user/anon/login接口
	 * @param username
	 * @return
	 */
    @GetMapping(value = "/anon/usernamelogin", params = "username")
    Result<SysUserBean> findByUsername(@RequestParam("username") String username);


	@GetMapping(value = "/anon/phonelogin", params = "phone")
	Result<SysUserBean> findByMobile(@RequestParam("phone") String phone);

	@GetMapping(value = "/anon/client", params = "clientId")
	Result<SysClientBean> loadClientByClientId(@RequestParam("clientId") String clientId);
    
}
